﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DSA
{
    public class DSA_List
    {
        //ATTRIBUTES

        private DSA_Row[] rows;
        private bool isComplete;
        private string name;

        public int TotalRows { get { return rows.Length; } }

        //CONSTRUCTOR
        public DSA_List(DSA_Row[] prod, string na)
        {
            rows = prod;
            name = na;
        }
 
        //PUBLIC ATTRIBUTES

        public string getName()
        {
            return name;
        }
        
        public void setName(string na)
        {
            name = na;

        }

        public void add_item()
        {

        }

        public void remove_item()
        {

        }

        public void edit_item()
        {
        }

        public DSA_Row get_row(int row)
        {
            if (row <= rows.Length)
                return rows[row];
            else
                return null;
        }

        public bool complete() //It checks if all the elemnts of the list are ticked
        {
            int i;
            bool b = true;

            for (i = 0; i > rows.Length; i++) 
            {
                if (!rows[i].Ticked)
                {
                    i = rows.Length + 1;
                    b = false;
                }   
            }

            return b;   
        }

        public void printlist()
        {
            foreach (DSA_Row r in rows)
            {
                Console.WriteLine(r.FormatInfo());
            }
        }

        public double GetTotal()
        {
            double total = 0;
            foreach (DSA_Row r in rows)
            {
                if (r.Ticked)
                    total += r.Price;
            }

            return total;
        }

        //PRIVATE ATTRIBUTES

       
    }
}
